package com.superman.supermarket.client.view.orderlist;

import java.util.List;
import java.util.Map;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Widget;
import com.superman.mvpframe.client.mvp.IPageViewPresenter;
import com.superman.mvpframe.client.widget.pulltorefresh.IPullToRefreshView;
import com.superman.mvpframe.client.widget.pulltorefresh.PullToRefreshViewAbstractImpl;
import com.superman.mvpframe.client.widget.tabbar.MyTabBar;
import com.superman.supermarket.client.composite.orderlist.OrderListModule;

/**
 * 订单列表ui实现类
 * 
 * @author superman
 * @version 2018年8月7日上午11:12:51
 */
public class OrderListViewImpl extends PullToRefreshViewAbstractImpl implements OrderListView {

	interface OrderListViewImplUiBinder extends UiBinder<Widget, OrderListViewImpl> {
	}

	private static OrderListViewImplUiBinder uiBinder = GWT.create(OrderListViewImplUiBinder.class);

	@UiField
	MyTabBar mytabbar;
	@UiField
	FlowPanel wrapperpanel, listpanel;

	/**
	 * 构造方法
	 * 
	 * @author superman
	 * @version 2018年8月7日 上午11:12:18
	 */
	public OrderListViewImpl() {
		initWidget(uiBinder.createAndBindUi(this));

		mytabbar.addTab("全部");
		mytabbar.addTab("待付款");
		mytabbar.addTab("待发货");
		mytabbar.addTab("待收货");
	}

	@Override
	public IPullToRefreshView getPullToRefreshView() {
		return this;
	}

	@Override
	public MyTabBar getTabBar() {
		return mytabbar;
	}

	@Override
	public void init() {
		// TODO Auto-generated method stub

	}

	@Override
	public void setDataListDivId(String id) {
		listpanel.getElement().setId(id);
	}

	@Override
	public void setListData(List<Map<String, Object>> list) {
		for (Map<String, Object> map : list) {
			OrderListModule orderListModule = new OrderListModule();
			orderListModule.getElement().getStyle().setProperty("marginTop", "0.266667rem");
			orderListModule.setData(map);
			listpanel.add(orderListModule);
		}
	}

	@Override
	public void setMeScrollDivId(String id) {
		wrapperpanel.getElement().setId(id);
	}

	@Override
	public void setPageViewPresenter(IPageViewPresenter presenter) {
		// TODO Auto-generated method stub

	}

}
